/**
 * Created by Nico on 2018/1/4.
 */
var tooltips = {
  init:function(id){
    //点击的按钮的id
    var elem = document.getElementById(id);
    console.log(elem)
    elem.addEventListener('mouseleave', this.clearTooltip);
    elem.addEventListener('blur', this.clearTooltip);
  },
  clearTooltip:function (e) {
    e.currentTarget.setAttribute('class', '');
    e.currentTarget.removeAttribute('aria-label');
  },
  showTooltip:function (elem, msg) {
    elem.setAttribute('class', 'tooltipped tooltipped-s');
    elem.setAttribute('aria-label', msg);
  },
  fallbackMessage:function (action) {
    var actionMsg = '';
    var actionKey = (action === 'cut' ? 'X' : 'C');
    if (/iPhone|iPad/i.test(navigator.userAgent)) {
      actionMsg = 'No support :(';
    } else if (/Mac/i.test(navigator.userAgent)) {
      actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
    } else {
      actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
    }
    return actionMsg;
  }
}
export default tooltips
